//
//  BaseTableView.m
//  UGoods
//
//  Created by dllo on 16/1/16.
//  Copyright © 2016年 蓝鸥科技.李贺. All rights reserved.
//

#import "BaseTableView.h"
#import "NightMode.h"
@implementation BaseTableView

- (void)dealloc
{
    // dealloc移除观察着
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [super dealloc];
}


- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    self = [super initWithFrame:frame style:style];
    if (self) {
        self.separatorStyle = UITableViewCellSelectionStyleNone;
        if ([NightMode nightModeSharedInstance].isNight) {
            [self setNightDayModel];
        } else {
            [self setLightDayModel];
        }
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setLightDayModel) name:@"day" object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setNightDayModel) name:@"night" object:nil];
    }
    return self;
}

- (void)setLightDayModel {
    self.backgroundColor = [UIColor colorWithWhite:0.950 alpha:1.000];
}

- (void)setNightDayModel {
    self.backgroundColor = [UIColor blackColor];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
